home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / VGAKIT60.ZIP / mode13x.asm < prev    next >
Assembly Source File  |  1994-01-01  |  2KB  |  101 lines

  1.  
  2.     include    model.inc
  3.  
  4. ;
  5. ;    VGAKIT Version 6.0
  6. ;
  7. ;    Copyright 1988,89,90,91,92,93,94 John Bridges
  8. ;    Free for use in commercial, shareware or freeware applications
  9. ;
  10. ;    MODE13X.ASM
  11. ;
  12. ;    Set the VGA 360 by 480 256 color mode.
  13. ;
  14. ;
  15. .data
  16.     extrn    maxx:word,maxy:word,scanline:word,ourseg:word,bksize:word
  17. .code
  18.  
  19. vptbl    dw    06b00h    ; horz total
  20.     dw    05901h    ; horz displayed
  21.     dw    05a02h    ; start horz blanking
  22.     dw    08e03h    ; end horz blanking
  23.     dw    05e04h    ; start h sync
  24.     dw    08a05h    ; end h sync
  25.     dw    00d06h    ; vertical total
  26.     dw    03e07h    ; overflow
  27.     dw    04009h    ; cell height
  28.     dw    0ea10h    ; v sync start
  29.     dw    0ac11h    ; v sync end and protect cr0-cr7
  30.     dw    0df12h    ; vertical displayed
  31.     dw    02d13h    ; offset
  32.     dw    00014h    ; turn off dword mode
  33.     dw    0e715h    ; v blank start
  34.     dw    00616h    ; v blank end
  35.     dw    0e317h    ; turn on byte mode
  36. vpend    label    word
  37.  
  38.  
  39.     extrn    mkadrtbl:proc
  40.  
  41. mode13x    proc
  42.     mov    [ourseg],0a000h
  43.     mov    [maxx],360
  44.     mov    [scanline],90
  45.     mov    [maxy],480
  46.     mov    [bksize],64
  47.     push    ds
  48.     mov    ax,cs
  49.     mov    ds,ax
  50.  
  51.     mov    ax,13h        ; start with standard mode 13h
  52.     int    10h        ; let the bios set the mode
  53.  
  54.     mov    dx,3c4h        ; alter sequencer registers
  55.     mov    ax,0604h    ; disable chain 4
  56.     out    dx,ax
  57.  
  58.     mov    ax,0f02h    ; set write plane mask to all bit planes
  59.     out    dx,ax
  60.     push    di
  61.     xor    di,di
  62.     mov    ax,0a000h    ; screen starts at segment A000
  63.     mov    es,ax
  64.     mov    cx,21600    ; ((XSIZE*YSIZE)/(4 planes))/(2 bytes per word)
  65.     xor    ax,ax
  66.     cld
  67.     rep    stosw        ; clear the whole of the screen
  68.     pop    di
  69.  
  70.     mov    ax,0100h    ; synchronous reset
  71.     out    dx,ax        ; asserted
  72.     mov    dx,3c2h        ; misc output
  73.     mov    al,0e7h        ; use 28 mHz dot clock
  74.     out    dx,al        ; select it
  75.     mov    dx,3c4h        ; sequencer again
  76.     mov    ax,0300h    ; restart sequencer
  77.     out    dx,ax        ; running again
  78.  
  79.     mov    dx,3d4h        ; alter crtc registers
  80.  
  81.     mov    al,11h        ; cr11
  82.     out    dx,al        ; current value
  83.     inc    dx        ; point to data
  84.     in    al,dx        ; get cr11 value
  85.     and    al,7fh        ; remove cr0 -> cr7
  86.     out    dx,al        ;    write protect
  87.     dec    dx        ; point to index
  88.     cld
  89.     mov    si,offset vptbl
  90.     mov    cx,((offset vpend)-(offset vptbl)) shr 1
  91. outlp:    lodsw
  92.     out    dx,ax
  93.     loop    outlp
  94.     pop    ds
  95.     call    mkadrtbl
  96.     ret
  97. mode13x    endp
  98.  
  99.     end
  100.  
  101.